cmake_minimum_required(VERSION 3.22)

project("jetpackdemo")

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

add_library( # Sets the name of the library.
        jetpackdemo

        # Sets the library as a shared library.
        SHARED

        # Provides a relative path to your source file(s).
        util/jni_map_util.cpp
        jni_string_util.cpp
        jetpackdemo.cpp)


include_directories("include")

add_library(
        ndkjni
        SHARED
        IMPORTED)

set_target_properties(
        ndkjni
        PROPERTIES IMPORTED_LOCATION
        #这里用绝对路径   相对路径很容易出错
        D:/JetpackDemo/app/src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI}/libndkjni.so
)


find_library( # Sets the name of the path variable.
        log-lib
        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

target_link_libraries( # Specifies the target library.
        jetpackdemo
        ndkjni
        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})
